#include "../inc/Score.h"
#include "../inc/Settings.h"

Score::Score()
  : f(Settings::screenWidth, Settings::screenHeight)
{
  reset();
}

void Score::printAt(float x, float y)
{
  char buffer[50];

  f.startText();
  sprintf(buffer, "Score: % .8u", val);
  f.printShadow(x + 0.1, y - 0.1, buffer);
  f.print(x, y, buffer);
  f.endText();
}

void Score::printFullAt(float x, float y)
{
  char buffer[50];
  
  f.startText();
  sprintf(buffer, " :             % .8u", val);
  f.printShadow(x + 0.1, y - 0.1, name);
  f.printShadow(x + 15.1, y - 0.1, buffer);
  f.print(x, y, name);
  f.print(x + 15.0, y, buffer);
  f.endText();
}

void Score::sumHits(long v)
{
  val += (unsigned long)(Settings::baseHitValue * v) + fact(v-1);
}
